Image processing device, image processing method, and image processing program

ABSTRACT

An image processing device according to one embodiment includes a calculation unit and a setting unit. The calculation unit calculates a degree of complexity indicating a degree of positional dispersion of edges in a target region where a text region is to be extracted. The setting unit sets an edge threshold for detecting the text region to low as the degree of complexity is low.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a National Stage of International Application No.PCT/JP2013/057001filed Mar. 13, 2013, the contents of all of which areincorporated herein by reference in their entirety.

TECHNICAL FIELD

One aspect of the present invention relates to an image processingdevice, an image processing method, and an image processing program.

BACKGROUND ART

In order to specify a text region in which text is drawn, there is atechnique that specifies the boundary (edge) between the text region andanother region. For example, the image processing device disclosed inPatent Literature 1 below calculates an edge component index valueindicating the amount of edge component contained in each segmentedregion, compares the edge component index value with a threshold andthereby determines whether there is an object to be detected in eachsegmented region.

CITATION LIST Patent Literature

PTL 1: JP 2012-008100 A

SUMMARY OF INVENTION Technical Problem

In the technique according to the related art, because the thresholdthat is used for edge detection is set to a fixed value by a rule ofthumb or the like, it is sometimes difficult to specify a text regionaccurately depending on the way text is drawn in the text region. Forexample, there is a case where a text region where the contrast with abackground region is low, such as translucent text, cannot be detectedaccurately. One way to solve this drawback is to uniformly reduce thethreshold for edge detection; however, this causes detection of anunnecessary edge, which is different from the edge of a text region tobe detected, in some images. In view of the above, it is desirable tomore reliably detect a text detection to be detected in accordance withimages.

Solution to Problem

An image processing device according to one aspect of the presentinvention includes a calculation unit configured to calculate a degreeof complexity indicating a degree of positional dispersion of edges in atarget region where a text region is to be extracted, and a setting unitconfigured to set an edge threshold for detecting the text region in thetarget region to low as the degree of complexity is low.

An image processing method according to one aspect of the presentinvention is an image processing method performed by an image processingdevice, the method including a calculation step of calculating a degreeof complexity indicating a degree of positional dispersion of edges in atarget region where a text region is to be extracted, and a setting unitconfigured to a setting step of setting an edge threshold for detectingthe text region in the target region to low as the degree of complexityis low.

An image processing program according to one aspect of the presentinvention causes a computer to implement a calculation unit configuredto calculate a degree of complexity indicating a degree of positionaldispersion of edges in a target region where a text region is to beextracted, and a setting unit configured to set an edge threshold fordetecting the text region in the target region to low as the degree ofcomplexity is low.

A computer-readable recording medium according to one aspect of thepresent invention stores an image processing program that causes acomputer to implement a calculation unit configured to calculate adegree of complexity indicating a degree of positional dispersion ofedges in a target region where a text region is to be extracted, and asetting unit configured to set an edge threshold for detecting the textregion in the target region to low as the degree of complexity is low.

According to the above aspects, the degree of complexity indicating thedegree of positional dispersion of edges is calculated for a targetregion, and the edge threshold is set to a lower value as the degree ofcomplexity is lower. In this manner, by setting the edge thresholddynamically according to the degree of complexity, it is possible todetect the edge in accordance with the characteristics of a targetregion and, as a result, it is possible to detect a text region morereliably.

In the image processing device according to another aspect, thecalculation unit may divide an original image into a plurality ofpatches, calculate a texture strength indicating a degree of variationin the amount of change in pixel value in the patch for each patch, andcalculate the degree of complexity of the target region composed of oneor more patches based on the texture strength of each patch.

In the image processing device according to another aspect, the targetregion may be the whole of the original image, and the calculation unitmay calculate the degree of complexity of the target region based on thetexture strength of each patch.

In the image processing device according to another aspect, thecalculation unit may group a plurality of patches having the texturestrength within a specified range and arranged continuously together,sets each group as the target region, and calculate the degree ofcomplexity of each target region.

In the image processing device according to another aspect, thecalculation unit may evenly divide the original image to generate aplurality of divided regions including a plurality of patches as thetarget region, and calculate the degree of complexity of each dividedregion based on the degree of complexity of each patch.

In the image processing device according to another aspect, thecalculation unit may obtain the degree of complexity of the targetregion by dividing the number of patches where the texture strength isequal to or higher than a specified value in the target region by thetotal number of patches in the target region.

In the image processing device according to another aspect, thecalculation unit may obtain the degree of complexity of the targetregion by dividing an average value of the texture strengths of thepatches where the texture strength is equal to or higher than aspecified value in the target region by a predetermined maximum value ofthe texture strength.

In the image processing device according to another aspect, the targetregion may be the patch, and the calculation unit may calculate thedegree of complexity of each target region based on the correspondingtexture strength.

In the image processing device according to another aspect, thecalculation unit may obtain the degree of complexity of the targetregion by dividing the texture strength in the target region by apredetermined maximum value of the texture strength.

Advantageous Effects of Invention

According to one aspect of the present invention, it is possible to morereliably detect a text detection to be detected in accordance withimages.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a view showing the concept of edge extraction according torelated art.

FIG. 2 is a view showing the concept of edge extraction according torelated art.

FIG. 3 is a view showing the concept of edge extraction according to anembodiment.

FIG. 4 is a view showing a hardware configuration of an image processingdevice according to the embodiment.

FIG. 5 is a block diagram showing a functional configuration of theimage processing device according to the embodiment.

FIG. 6 is a view showing an example of dividing an original image into aplurality of patches.

FIG. 7 is a view showing an example of eigen decomposition.

FIG. 8 is a view showing examples of texture strengths.

FIG. 9 is a flowchart showing an operation of the image processingdevice according to the embodiment.

FIG. 10 is a view showing a configuration of an image processing programaccording to the embodiment.

DESCRIPTION OF EMBODIMENTS

An embodiment of the present invention is described hereinafter indetail with reference to the appended drawings. Note that, in thedescription of the drawings, the same or equivalent elements are denotedby the same reference symbols, and the redundant explanation thereof isomitted.

The functions and configuration of an image processing device 10according to an embodiment are described hereinafter with reference toFIGS. 1 to 8. The image processing device 10 is a computer system thatdetects an edge, which is the outline of text superimposed on an image.Note that “text” in this specification is the concept including a mark,a figure or the like of a certain shape.

Images in which text is superimposed on pictures are seen in variousscenes. For example, in a virtual shopping mall that sells a largevariety of products, images in which text is superimposed on productpictures are often used as product images. When drawing text in animage, in not a few cases, text with low contrast, such as translucenttext or text in the color close to the background color, is used interms of design. In this specification, an image in which text is drawnis referred to also as “text image”.

On the other hand, in the processing such as the Canny method thatspecifies the edge of text from a text image, it is necessary to set athreshold (edge threshold) for specifying the edge. However, becausethere are various ways text is drawn, if one fixed value is used as theedge threshold, while the edge of text can be appropriately specifiedfor some images, it cannot be appropriately specified for other imagesin some cases.

As one example, consider the processing of extracting the edge from eachof two text images Ga and Gb shown in FIG. 1. The image Ga is an imagein which the two letter strings “WXYZ” and “bucket” in the same darknessare superimposed on the picture of a bucket placed on a lawn. The imageGb is an image in which the letter string “ABCD” is superimposed on thepicture of a communication module. The transparency of the letter string“ABCD” is higher than that of the letter strings “WXYZ” and “bucket”,and therefore “WXYZ” and “bucket” are darker than “ABCD”.

It is necessary to set the edge threshold to high in order toappropriately specify the edge of “WXYZ” and “bucket” that are drawn inthe image Ga. When the edge threshold is THa, “WXYZ” and “bucket” in theimage Ga can be clearly specified as shown in FIG. 1. However, when theedge threshold THa is applied to the processing of the image Gb, becausethe transparency of the letter string “ABCD” is high, the edge of theletter string cannot be extracted as shown in FIG. 1 in some cases.

In order to appropriately specify the edge of “ABCD” that is drawn inthe image Gb, it is necessary to set the edge threshold to a value THbthat is lower than THa as shown in FIG. 2. However, when the edgethreshold THb is applied to the processing of the image Ga, not only thetwo letter strings but also the edges of the lawn and the bucket areextracted and intersect or ovelap with the edges of the letter strings.It is thus not possible to correctly extract the text “WXYZ” and“bucket”.

In order to appropriately specify the edge of each text drawn indifferent levels of contrast in different images, the image processingdevice 10 determines the edge threshold dynamically for each image.According to this embodiment, a high threshold THa′ is set for the imageGa, and a lower threshold THb′ (i.e. THa′>THb′) is set for the image Gbas shown in FIG. 3, and it is thereby possible to correctly extract theedge of text in both of the two images Ga and Gb.

FIG. 4 shows a hardware configuration of the image processing device 10.The image processing device 10 includes a CPU 101 that executes anoperating system, an application program and the like, a main storageunit 102 such as ROM and RAM, an auxiliary storage unit 103 such as ahard disk or a flash memory, a communication control unit 104 such as anetwork card or a wireless communication module, an input device 105such as a keyboard and a mouse, and an output device 106 such as adisplay.

The functional elements of the image processing device 10, which aredescribed later, are implemented by loading given software onto the CPU101 or the main storage unit 102, making the communication control unit104, the input device 105, the output device 106 and the like operateunder control of the CPU 101, and performing reading and writing of datain the main storage unit 102 or the auxiliary storage unit 103. The dataand databases required for processing are stored in the main storageunit 102 or the auxiliary storage unit 103.

Note that the image processing device 10 may be composed of one computeror may be composed of a plurality of computers.

As shown in FIG. 5, the image processing device 10 includes, asfunctional elements, a calculation unit 11, a setting unit 12, and adetection unit 13.

The calculation unit 11 is a functional element that calculates thedegree of complexity in a target region where a text region is to beextracted.

First, the calculation unit 11 receives data A of one original image anddivides the original image data A into a plurality of patches B as shownin FIG. 6. Although the size of one patch is 7 pixels by 7 pixels inthis embodiment, the size of the patch is not limited thereto and may beset arbitrarily.

Next, the calculation unit 11 calculates a texture strength indicatingthe degree of variation (variance) in the amount of change in pixelvalue for each of a plurality of patches. In the image region (forexample, the lawn region in the image Ga) with the large variation inthe amount of change, the position of the color (edge) is dispersed. Theamount of change in pixel value is a gradient between two adjacentpixels, and it can be obtained for each of the horizontal direction andthe vertical direction of a patch.

The calculation unit 11 calculates a gradient matrix G for a patch w_(i)composed of a plurality of pixels by the following equation (1),

$\begin{matrix}{{G = \begin{bmatrix}\vdots & \vdots \\{p_{x}(k)} & {p_{y}(k)} \\\vdots & \vdots\end{bmatrix}},{k \in w_{i}}} & (1)\end{matrix}$where [p_(x)(k),p_(y)(k)]^(T) indicates a gradient in a pixel (x_(k),y_(k)), and T indicates a transposed matrix.

Then, the calculation unit 11 calculates a gradient covariance matrix Cby the following equation (2). T indicates a transposed matrix.C=G^(T)G  (2)

Main information about the patch w_(i) can be derived from the gradientmatrix G and the gradient covariance matrix C.

After that, the calculation unit 11 calculates a local dominantdirection in a patch and energy in the direction by using an eigenvectorand an eigenvalue of the gradient covariance matrix C.

Eigen decomposition performed by the calculation unit 11 is representedby the following equations (3) and (4). First, the gradient matrix G isrepresented by the following equation (3).

$\begin{matrix}{G = {{USV}^{T} = {{U\begin{bmatrix}s_{1} & 0 \\0 & s_{2}\end{bmatrix}}\left\lbrack {v_{1}v_{2}} \right\rbrack}^{T}}} & (3)\end{matrix}$where U and V are orthonormal matrices. v₁ is a column vector indicatingthe dominant direction. v₂ is a column vector orthogonal to the columnvector v₁, indicating the edge direction. s₁ indicates energy in thedominant direction, and s₂ indicates energy in the edge direction.

Accordingly, the gradient covariance matrix C is represented by thefollowing equation (4).

$\begin{matrix}{C = {{{VS}^{T}{SV}^{T}} = {{V\begin{bmatrix}s_{1}^{2} & 0 \\0 & s_{2}^{2}\end{bmatrix}}V^{T}}}} & (4)\end{matrix}$

FIG. 7 shows an example of eigen decomposition. s₁ in this viewindicates energy in the dominant direction, and s₂ indicates energy inthe edge direction. In the example of FIG. 7, the edge direction isdefined in the direction along the striped pattern (see the arrow in theimage).

Then, the calculation unit 11 calculates a trace, which is the sum ofeigenvalues in the gradient covariance matrix C, as a texture strengthξof the patch. “tr( )” in the following equation (5) is an operatorindicating the trace.ξ=tr(C)  (5)

The texture strength ξ is described with reference to FIG. 8 for easierunderstanding. FIG. 8 shows an example of three patches Bx, By and Bzrepresented in a gray scale and the texture strength ξ of each patch.When the pixel values are substantially uniform as in the patch Bz, thetexture strength is significantly low, and when the pixel values in apatch are all the same, the texture strength is 0. On the other hand,when the color becomes darker (or lighter) linearly as in the patch By,the texture strength is higher. Further, when the pixel values are alldifferent (when the position of the edge is dispersed) as in the patchBx, the texture strength is even higher. In this manner, the texturestrength indicates the degree of positional dispersion of edges in thepatch.

The calculation unit 11 performs the processing including thecalculation of the above equations (1) to (5) for each patch and therebycalculates the texture strength of each patch.

After that, the calculation unit 11 calculates the degree of complexityin the target region where a text region is to be detected by using oneedge threshold. The range of the target region and the calculationmethod of the degree of complexity are not particularly limited, andvarious methods can be used as follows.

[Method of setting the whole original image as one target region] Thecalculation unit 11 may set the whole original image as one targetregion. The calculation unit 11 has a predetermined work thresholdξ_(th) for sorting into patches with a high texture strength and patcheswith a low texture strength. Then, the calculation unit 11 obtains thenumber of patches Nc where the texture strength ξ is equal to or higherthan the threshold ξ_(th) among a plurality of patches obtained from theoriginal image. The calculation unit 11 then divides the value Nc by thetotal number of patches N and thereby obtains the degree of complexity Rof the target region. This is represented by the equation R=Nc/N.

Alternatively, the calculation unit 11 may obtain the overall degree ofcomplexity R by the following equation (6).

$\begin{matrix}{{R\left( {\sum\limits_{i}^{Nc}\;{\xi_{i}/{Nc}}} \right)}/\xi_{\max}} & (6)\end{matrix}$where Nc is the number of patches where the texture strength ξ is equalto or higher than the work threshold ξ_(th) among a plurality of patchesobtained from the original image. ξ_(max) is a predetermined maximumvalue of the texture strength. The equation (6) indicates that thedegree of complexity of the target region is obtained by dividing theaverage value of the texture strengths of the patches where the texturestrength is equal to or higher than a specified value in the targetregion by the predetermined maximum value of the texture strength.

In the above method, the texture strength is calculated for each smallpatch of 7×7 pixels, and then the degree of complexity of the wholeimage is calculated. Another possible method is to calculate the texturestrength of the whole image by applying the above-described processingof calculating the texture strength to the whole image. However, in thiscase, the effect of a local edge is ignored, dominated by the strengthof a large edge in the whole image. To avoid this, by dividing the imageinto patches, calculating the texture strength for each patch and thencalculating the degree of complexity of the whole image by using thetexture strength, it is possible to accurately calculate the degree ofcomplexity of the whole image.

[Method of setting a plurality of target regions] The calculation unit11 may set a plurality of target regions by dividing the original imageand calculate the degree of complexity R for each target region.

The method of dividing the original image is not limited. For example,the calculation unit 11 may evenly divide the original image into apredetermined number of parts (for example, eight equal parts, sixteenequal parts etc.). Then, the calculation unit 11 obtains the degree ofcomplexity R for each target region by the same way as in the case ofapplying one degree of complexity R to the whole original image.

Alternatively, the calculation unit 11 may divide the original imagedynamically by grouping a plurality of patches whose texture strength iswithin a specified range and which are arranged continuously togetherbased on the position and the texture strength of each patch. Then, thecalculation unit 11 obtains the degree of complexity R for each targetregion by the same way as in the case of applying one degree ofcomplexity R to the whole original image. In this manner, thecalculation unit 11 may group a plurality of patches in a cluster basedon the texture strength and thereby divide the image into a region witha high texture strength and a high degree of complexity and a regionwith a low texture strength and a low degree of complexity.

[Use of a different edge threshold for each patch] The calculation unit11 may set the degree of complexity R for each patch. In this case, thecalculation unit 11 calculates the degree of complexity R by thefollowing equation (7) based on a predetermined maximum value ξ_(max) ofa texture strength and the texture strength ξ of a patch.R=ξ/ξ_(max)  (7)

In this manner, the calculation unit 11 calculates the degree ofcomplexity R based on the texture strength ξ. By this calculation, thedegree of positional dispersion of edges is obtained in the targetregion. Because the degree of complexity R is higher as the texturestrength ξ is higher, the texture strength ξ can be regarded as one typeof the degree of complexity.

After calculating the degree of complexity R for one target region oreach of a plurality of target regions, the calculation unit 11 generatesinformation about the target region and outputs it to the setting unit12. Each record of target region information is data in which anidentifier that uniquely identifies a target region, the position orrange of the target region, and the degree of complexity R set for thetarget region are associated with one another.

The setting unit 12 is a functional element that sets an edge thresholdto be used for detection of a text region from a target region. Thesetting unit 12 has a reference value (reference threshold) TH_(org) ofan edge threshold in advance. The setting unit 12 multiplies thereference value TH_(org) by the degree of complexity R of a targetregion and thereby obtains the final edge threshold TH to be used forthe target region. Then, the setting unit 12 sets the edge threshold THas a part of information of the target region.

Because the edge threshold is obtained by TH=TH_(org)×R, the edgethreshold of a target region increases linearly with respect to thedegree of complexity in this embodiment. However, because it is onlynecessary to set an edge threshold in such a way that the edge thresholdincreases as the degree of complexity of a target region is higher, therelational expression between the edge threshold and the degree ofcomplexity is not limited. The setting unit 12 may calculate the finaledge threshold from the degree of complexity by using a calculationmethod other than the simple multiplication. For example, the settingunit 12 may increase the edge threshold nonlinearly with respect to thedegree of complexity.

In the case where a plurality of target regions are set, the settingunit 12 sets the edge threshold TH for each target region and adds theedge threshold TH to each target region information. The setting unit 12outputs the target region information to which the edge threshold hasbeen added, to the detection unit 13.

The detection unit 13 is a functional element that detects the edge of atext region from a target region by using a set edge threshold. Forexample, the detection unit 13 can detect the edge by using the Cannymethod. Because the Canny method uses two thresholds, the detection unit13 uses a set edge threshold as a first threshold, and uses anothervalue that is set based on the edge threshold as a second threshold. Forexample, the detection unit 13 uses a value that is twice the edgethreshold as the second threshold. The edge detection that is suitablefor the whole part or each divided region of the original image isthereby achieved as shown in FIG. 3. As a matter of course, a method ofdetecting a text region is not limited to the Canny method, and thedetection unit 13 may detect a text region using any method.

The operation of the image processing device 10 is described, andfurther an image processing method according to this embodiment isdescribed hereinafter with reference to FIG. 9.

First, the calculation unit 11 divides the original image into aplurality of patches (Step S11), and calculates the texture strength ofeach patch (Step S12, calculation step). Next, the calculation unit 11calculates the degree of complexity of one or a plurality of targetregions based on the texture strength (Step S13, calculation step).Then, the setting unit 12 sets the edge threshold of the target regionby using the degree of complexity (Step S14, setting step). After that,the detection unit 13 detects the edge of the text region by using theedge threshold (Step S15).

An image processing program P for implementing the image processingdevice 10 is described hereinafter with reference to FIG. 10.

The image processing program P includes a main module P10, a calculationmodule P11, a setting module P12, and a detection module P13.

The main module P10 is a part that exercises control over the imageprocessing function. The functions implemented by executing thecalculation module P11, the setting module P12 and the detection moduleP13 are equal to the functions of the calculation unit 11, the settingunit 12 and the detection unit 13 described above, respectively.

The image processing program P may be provided in the form of beingrecorded in a static manner on a tangible recording medium such asCD-ROM or

DVD-ROM or semiconductor memory, for example. Further, the imageprocessing program P may be provided as a data signal superimposed ontoa carrier wave through a communication network.

As described above, according to this embodiment, the degree ofcomplexity indicating the degree of positional dispersion of edges iscalculated for a target region, and the edge threshold is set to a lowervalue as the degree of complexity is lower. In this manner, by settingthe edge threshold dynamically according to the degree of complexity, itis possible to detect the edge in accordance with the characteristics(for example, the texture strength) of a target region and therebydetect a text region more reliably.

In the case where text is inserted into an image in such a way that itcannot be extracted by uniform text extraction processing, there is atendency that the contrast of text is set to low to the extent that itis visible to human eyes (for example, translucent text) so that thetext does not stand out too much. Thus, by setting a threshold accordingto the degree of complexity of the image, it is possible to extract theedge of text, avoiding the detection of an unnecessary edge other thantext.

There is a case where text with low contrast with a background region isinserted into an image in order to prevent that text such asadvertisement inserted into an image is detected by mechanical textdetection processing. As a result of detailed analysis by the presentinventors, it is found that text with relatively high contrast isinserted into an image with a high degree of complexity, and text withrelatively low contrast is inserted into an image with a low degree ofcomplexity. The degree of complexity indicates the degree of positionaldispersion of edges over an image region. The image with a high degreeof complexity is a lawn region in the image Ga or a patch Bx, forexample,

In the case of inserting text such as advertisement into an image with arelatively high degree of complexity, it is considered that text withrelatively high contrast is inserted so that it is recognizable by humaneyes. On the other hand, while human can read text with relatively lowcontrast that is inserted into an image with a relatively low degree ofcomplexity, if text with high contrast is inserted into such an image,it is likely to be detected. Therefore, it is considered that text withrelatively low contrast is inserted into an image with a relatively lowdegree of complexity.

Thus, by setting a threshold for edge detection to a lower value as thedegree of complexity of an image region where an edge is to be detectedis lower, it is possible to appropriately set the threshold for edgedetection in accordance with the contrast between an inserted textregion and a background region.

If one degree of complexity is set for the whole original image, it isonly necessary to use one edge threshold for detection of a text region,which makes processing easy. On the other hand, if an image region isdivided into a plurality of regions and an edge threshold is set foreach region, it is possible to perform edge detection that is suitablefor the characteristics of each of the divided regions.

An embodiment of the present invention is described in detail above.However, the present invention is not limited to the above-describedembodiment. Various changes and modifications may be made to the presentinvention without departing from the scope of the invention.

Although the calculation unit 11 uses eigen decomposition in theabove-described embodiment, a technique to be used for calculation ofthe texture strength is not limited. The calculation unit 11 maycalculate the texture strength by using another technique such asprincipal component analysis or frequency analysis.

REFERENCE SIGNS LIST

10 . . . image processing device, 11 . . . calculation unit, 12 . . .setting unit, 13 . . . detection unit, P . . . image processing program,P10 main module, P11 . . . calculation module, P12 . . . setting module,P13 . . . detection module

The invention claimed is:
 1. An image processing device comprising: atleast one memory operable to store computer program instructions; atleast one processor operable to access said at least one memory, readsaid program instructions and operate according to said programinstructions, said program instructions including: calculationinstructions configured to cause at least one of said at least oneprocessor to calculate a degree of complexity indicating a degree ofpositional dispersion of edges in a target region where a text region isto be extracted, based on a texture strength indicating a degree ofchange in pixel value in the target region; and setting instructionsconfigured to cause at least one of said at least one processor to setan edge threshold for detecting the text region in the target region,the edge threshold being set lower as the degree of complexity is lower,wherein the calculation instructions are further configured to cause atleast one of the at least one processor to: divide an original imageinto a plurality of patches; calculate the texture strength for eachpatch; and calculate the degree of complexity of the target regioncomposed of one or more patches based on one or more patches where thetexture strength is equal to or higher than a predetermined threshold inthe target region.
 2. The image processing device according to claim 1,wherein the target region is the whole of the original image.
 3. Theimage processing device according to claim 1, wherein the calculationinstructions are further configured to cause at least one of said atleast one processor to group a plurality of patches having the texturestrength within a specified range and arranged continuously together,set each group as the target region, and calculate the degree ofcomplexity of each target region.
 4. The image processing deviceaccording to claim 1, wherein the calculation instructions are furtherconfigured to cause at least one of said at least one processor toevenly divide the original image to generate a plurality of dividedregions including a plurality of patches, and calculate the degree ofcomplexity of each divided region based on the degree of complexity ofeach patch.
 5. The image processing device according to claim 1, whereinthe calculation instructions are further configured to cause at leastone of said at least one processor to obtain the degree of complexity ofthe target region by dividing the number of patches where the texturestrength is equal to or higher than a specified value in the targetregion by the total number of patches in the target region.
 6. The imageprocessing device according to claim 1, wherein the calculationinstructions are further configured to cause at least one of said atleast one processor to obtain the degree of complexity of the targetregion by dividing an average value of the texture strengths of theplurality of patches where the texture strength is equal to or higherthan a specified value in the target region by a predetermined maximumvalue of the texture strength.
 7. An image processing method performedby an image processing device, comprising: calculating a degree ofcomplexity indicating a degree of positional dispersion of edges in atarget region where a text region is to be extracted, based on a texturestrength indicating a degree of change in pixel value in the targetregion; and setting an edge threshold for detecting the text region inthe target region, the edge threshold being set lower as the degree ofcomplexity is lower, wherein the calculating comprises: dividing anoriginal image into a plurality of patches; calculating the texturestrength for each patch; and calculating the degree of complexity of thetarget region composed of one or more patches base on one or morepatches where the texture strength is equal to or higher than apredetermined threshold in the target region.
 8. A non-transitorycomputer-readable recording medium storing an image processing programcausing a computer to execute a method comprising: calculating a degreeof complexity indicating a degree of positional dispersion of edges in atarget region where a text region is to be extracted, based on a texturestrength indicating a degree of change in pixel value in the targetregion; and setting an edge threshold for detecting the text region inthe target region, the edge threshold being set lower as the degree ofcomplexity is lower, wherein the calculating comprises: dividing anoriginal image into a plurality of patches; calculating the texturestrength for each patch; and calculating the degree of complexity of thetarget region composed of one or more patches based on one or morepatches where the texture strength is equal to or higher than apredetermined threshold in the target region.
 9. An image processingdevice comprising: at least one memory operable to store computerprogram instructions; at least one processor operable to access the atleast one memory, read the program instructions and operate according tothe program instructions, the program instructions including:calculation instructions configured to cause at least one of the atleast one processor to calculate a degree of complexity indicating adegree of positional dispersion of edges in a target region where a textregion is to be extracted, based on a texture strength indicating adegree of change in pixel value in the target region; and settinginstructions configured to cause at least one of the at least oneprocessor to set an edge threshold for detecting the text region in thetarget region, the edge threshold being set lower as the degree ofcomplexity is lower, wherein the calculation instructions are furtherconfigured to cause at least one of the at least one processor to:divide an original image into a plurality of patches: calculate thetexture strength for each patch; and calculate, for each patch, thedegree of complexity of the patch by dividing the texture strength inthe patch by a predetermined maximum value of the texture strength. 10.An image processing method performed by an image processing device,comprising: calculating a degree of complexity indicating a degree ofpositional dispersion of edges in a target region where a text region isto be extracted, based on a texture strength indicating a degree ofchange in pixel value in the target region; and setting an edgethreshold for detecting the text region in the target region, the edgethreshold being set lower as the degree of complexity is lower, whereinthe calculating comprises: dividing an original image into a pluralityof patches; calculating the texture strength for each patch; andcalculating, for each patch, the degree of complexity of the patch bydividing the texture strength in the patch by a predetermined maximumvalue of the texture strength.
 11. A non-transitory computer-readablerecording medium storing an image processing program causing a computerto execute a method comprising: calculating a degree of complexityindicating a degree of positional dispersion of edges in a target regionwhere a text region is to be extracted, based on a texture strengthindicating a degree of change in pixel value in the target region; andsetting an edge threshold for detecting the text region in the targetregion, the edge threshold being set lower as the degree of complexityis lower, wherein the calculating comprises: dividing an original imageinto a plurality of patches; calculating the texture strength for eachpatch; and calculating, for each patch, the degree of complexity of thepatch by dividing the texture strength in the patch by a predeterminedmaximum value of the texture strength.